<template>
   <div class="scopePage cancelPadding">
     <div class="toolbox">
          <span>时间选择 : </span>&nbsp;
          <div class="layoutBox" style="width:242px">
            <el-date-picker v-model="dateRange" type="daterange" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
          </div>&emsp;&emsp;
          <span>监测项目 : </span>&nbsp;
          <div class="layoutBox" style="width:120px">
            <el-select v-model="value" multiple collapse-tags placeholder="请选择" @change="selectChange">
                  <el-option
                    v-for="item in optionData"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
                  </el-option>
            </el-select>
          </div>&emsp;&emsp;
          <el-button @click="search"><i class="iconfont icon-sousuo"></i>查询</el-button>
          <el-button type='delet'><i class="iconfont icon-daochu"></i>导出</el-button>
     </div>
    <div class="table">
          <el-table border :data="tableData">
                <el-table-column type='index' label='序号' width='45'></el-table-column>
                <el-table-column  label='时间' prop='area' width='200'></el-table-column>
                <el-table-column :label='item.name' v-for="(item,key) in tableHead" :key="key"></el-table-column>
                 <el-table-column  label='综合水质类别' prop='area'></el-table-column>
          </el-table>
    </div>
  </div>
</template>

<script>
export default {
  name: "",
  data() {
    return {
      dateRange: "",
      value: "",
      optionData: [
        { value: 1, label: "水温" },
        { value: 2, label: "溶解氧" },
        { value: 3, label: "高锰酸盐" },
        { value: 4, label: "氨氮" },
        { value: 5, label: "总磷" }
      ],
      tableData: [{ area: "" }],
      tableHead: [],
      monitorFactor: [1, 2, 3, 4, 5]
    };
  },
  created() {
    this.$store.commit("setShowlefttree", false);
    this.search();
  },
  methods: {
    selectChange(arr) {
      this.monitorFactor = arr;
    },
    //查询
    search() {
      this.tableHead = [];
      for (let i in this.monitorFactor) {
        for (let j in this.optionData) {
          if (this.monitorFactor[i] == this.optionData[j].value) {
            this.tableHead.push({
              name: this.optionData[j].label
            });
          }
        }
      }
    }
  }
};
</script>

<style scope lang="less">
.scopePage {
}
</style>
